<template>
  <view :style="themeColor">
    <view class="page">
      <view class="flex flex-direction flex-wrap align-stretch benben-position-layout flex monthExpenses_flex_0"
        :style="{height:(88+StatusBarRpx)+'rpx',paddingTop:StatusBarRpx+'rpx', }">
        <view class='flex flex-wrap align-center justify-between flex-sub monthExpenses_fd0_0'>
          <view class='flex flex-wrap align-center monthExpenses_fd0_0_c0' @tap.stop="handleJumpDiy" data-type="back"
            data-url="1">
            <text class='fu-iconfont2  monthExpenses_fd0_0_c0_c0'>&#xE794;</text>
          </view>
          <view class='flex flex-wrap align-stretch justify-center'>
            <text class='monthExpenses_fd0_0_c1_c0'>当月收支</text>
          </view>
          <view class='flex flex-wrap align-center justify-end monthExpenses_fd0_0_c0'>
            <image class='monthExpenses_fd0_0_c2_c0' mode="aspectFit" :src='STATIC_URL+"7.png"'></image>
          </view>
        </view>

      </view>
      <view :style="{height: (88+StatusBarRpx)+'rpx'}"></view>
      <!---flex布局flex布局开始-->
      <view class="flex flex-direction flex-wrap align-stretch benben-flex-layout monthExpenses_flex_1">
        <view class='flex flex-wrap align-center monthExpenses_fd1_0'>
          <text class='monthExpenses_fd1_0_c0'>本月收支统计</text>
        </view>
      </view>

      <!---flex布局flex布局结束-->
      <!---flex布局flex布局开始-->
      <view class="flex flex-direction flex-wrap align-stretch benben-flex-layout monthExpenses_flex_2">
        <view class='flex flex-direction flex-wrap align-stretch monthExpenses_fd2_0'>
          <view class='flex flex-direction flex-wrap align-stretch'>
            <view class='flex flex-wrap align-center' style="margin-left: 24rpx;">
              <view class='flex flex-wrap align-center monthExpenses_fd2_0_c0_c0_c0'>
                <text class='monthExpenses_fd2_0_c0_c0_c0_c0'>收购量</text>
                <text class='monthExpenses_fd2_0_c0_c0_c0_c1'>(斤)</text>
              </view>
              <view class='flex flex-wrap align-center monthExpenses_fd2_0_c0_c0_c1'>
                <text class='monthExpenses_fd2_0_c0_c0_c0_c0'>销售量</text>
                <text class='monthExpenses_fd2_0_c0_c0_c0_c1'>(斤)</text>
              </view>
            </view>
            <view class='flex flex-wrap align-center monthExpenses_fd2_0_c0_c1'>
              <text class='monthExpenses_fd2_0_c0_c1_c0'>小麦</text>
              <text class='monthExpenses_fd2_0_c0_c1_c1'>{{info.leixing1_xiaomai_jingzhong_total}}</text>
              <text class='monthExpenses_fd2_0_c0_c1_c2'>{{info.leixing2_xiaomai_jingzhong_total}}</text>
            </view>
            <view class='flex flex-wrap align-center monthExpenses_fd2_0_c0_c2'>
              <text class='monthExpenses_fd2_0_c0_c1_c0'>玉米</text>
              <text class='monthExpenses_fd2_0_c0_c1_c1'>{{info.leixing1_yumi_jingzhong_total}}</text>
              <text class='monthExpenses_fd2_0_c0_c1_c2'>{{info.leixing2_yumi_jingzhong_total}}</text>
            </view>
          </view>
          <view class='flex flex-direction flex-wrap align-stretch'>
            <view class='flex flex-wrap align-center' style="margin-left: 24rpx;">
              <view class='flex flex-wrap align-center monthExpenses_fd2_0_c1_c0_c0'>
                <text class='monthExpenses_fd2_0_c0_c0_c0_c0'>收购均价</text>
                <text class='monthExpenses_fd2_0_c0_c0_c0_c1'>(斤)</text>
              </view>
              <view class='flex flex-wrap align-center monthExpenses_fd2_0_c1_c0_c1'>
                <text class='monthExpenses_fd2_0_c0_c0_c0_c0'>销售均价</text>
                <text class='monthExpenses_fd2_0_c0_c0_c0_c1'>(斤)</text>
              </view>
            </view>
            <view class='flex flex-wrap align-center monthExpenses_fd2_0_c0_c1'>
              <text class='monthExpenses_fd2_0_c0_c1_c0'>小麦</text>
              <text class='monthExpenses_fd2_0_c1_c1_c1'>{{info.leixing1_xiaomai_junjia_total}}</text>
              <text class='monthExpenses_fd2_0_c1_c1_c2'>{{info.leixing2_xiaomai_junjia_total}}</text>
            </view>
            <view class='flex flex-wrap align-center monthExpenses_fd2_0_c0_c2'>
              <text class='monthExpenses_fd2_0_c0_c1_c0'>玉米</text>
              <text class='monthExpenses_fd2_0_c1_c1_c1'>{{info.leixing1_yumi_junjia_total}}</text>
              <text class='monthExpenses_fd2_0_c1_c2_c2'>{{info.leixing2_yumi_junjia_total}}</text>
            </view>
          </view>
        </view>
      </view>

      <!---flex布局flex布局结束-->
      <!---flex布局flex布局开始-->
      <view class="flex flex-wrap align-center justify-center benben-flex-layout monthExpenses_flex_3">
        <text class='monthExpenses_fd3_0' v-if=" state=='1'">玉米</text>
        <text class='monthExpenses_fd3_0_1' v-if=" state=='2'" @tap.stop="harvestingGrainFunc()">玉米</text>
        <text class='monthExpenses_fd3_1' v-if=" state=='1'" @tap.stop="harvestingGrainFunc()">小麦</text>
        <text class='monthExpenses_fd3_1_1' v-if=" state=='2'">小麦</text>
      </view>

      <!---flex布局flex布局结束-->
      <!---flex布局flex布局开始-->
      <view class="flex flex-direction flex-wrap align-stretch benben-flex-layout monthExpenses_flex_4">
        <view class='flex flex-direction flex-wrap align-stretch monthExpenses_fd4_0' @tap.stop="handleJumpDiy"
          v-for="(item,index) in dataList" :key="index" data-type="navigateTo"
          :data-url="`/pages/wode/dailyExpenditure/dailyExpenditure?create_time=${item.datetime}`">
          <view class='flex flex-wrap align-center justify-between'>
            <text class='monthExpenses_fd4_0_c0_c0'>{{item.datetime}}</text>
            <text class='monthExpenses_fd4_0_c0_c1'>查看详情</text>
          </view>
          <view class='flex flex-direction flex-wrap align-stretch monthExpenses_fd4_0_c1'>
            <view class='flex flex-wrap align-center justify-between'>
              <text class='monthExpenses_fd4_0_c1_c0_c0'>收</text>
              <text class='monthExpenses_fd4_0_c1_c0_c1'
                style="width: 200rpx;text-align: center;">{{item.jingzhong1}}斤</text>
              <view class='flex flex-wrap align-center' style="width: 200rpx;text-align: center;">
                <text class='monthExpenses_fd4_0_c1_c0_c1'>{{item.junjia1}}</text>
                <text class='monthExpenses_fd4_0_c1_c0_c1'>元/斤</text>
              </view>
            </view>
            <view class='flex flex-wrap align-center justify-between monthExpenses_fd4_0_c1_c1'>
              <text class='monthExpenses_fd4_0_c1_c0_c0'>出</text>
              <text class='monthExpenses_fd4_0_c1_c0_c1'
                style="width: 200rpx;text-align: center;">{{item.jingzhong2}}斤</text>
              <view class='flex flex-wrap align-center' style="width: 200rpx;text-align: center;">
                <text class='monthExpenses_fd4_0_c1_c0_c1'>{{item.junjia2}}</text>
                <text class='monthExpenses_fd4_0_c1_c0_c1'>元/斤</text>
              </view>
            </view>
          </view>
        </view>
      </view>

      <!---flex布局flex布局结束-->
      <fu-empty-ui v-if="dataList.length==0"></fu-empty-ui>

    </view>
  </view>
</template>
<script>
  export default {
    components: {},


    data() {
      return {
        "state": "1",
        date: '',
        dataList: [],
        info: {
          leixing1_xiaomai_jingzhong_total: 0,
          leixing1_xiaomai_junjia_total: 0,
          leixing1_yumi_jingzhong_total: 0,
          leixing1_yumi_junjia_total: 0,
          leixing2_xiaomai_junjia_total: 0,
          leixing2_xiaomai_shougoujia_total: 0,
          leixing2_yumi_jingzhong_total: 0,
          leixing2_yumi_junjia_total: 0,
        },
        month: ''
      };
    },
    computed: {
      themeColor() {
        return this.$store.getters.themeColor
      },

    },
    watch: {},
    async onLoad(options) {
      var timeStamp = new Date();
      if (options.create_time) {
        this.date = options.create_time
        this.month = options.create_time.split('-')[1]
        console.log(';;;', this.month)
      } else {
        this.date = this.$util.timeFormat(timeStamp, 'yy-mm-dd')
      }
      await this.getList()
    },
    onUnload() {

    },
    onReady() {

    },
    onShow() {

    },
    onHide() {

    },
    onResize() {

    },
    onPullDownRefresh() {

    },
    onReachBottom(e) {

    },
    onPageScroll(e) {

    },
    methods: {
      getList() {
        this.$api.post(global.apiUrls.post65d701d1defc9, {
          leixing: this.state,
          create_time: this.date,
          month: this.month
        }).then(res => {
          if (res.data.code == 1) {
            this.dataList = res.data.data.list
            this.info = res.data.data.info

          }
        })
      },
      //收粮卖粮
      harvestingGrainFunc() {
        if (this.state == '1') {
          this.state = '2';
        } else if (this.state == '2') {
          this.state = '1';
        }
        this.getList()
      }
    }
  };
</script>
<style lang="scss" scoped>
  .page {
    width: 100vw;
    overflow-x: hidden;
    min-height: calc(100vh - var(--window-bottom));
    background: rgba(248, 248, 250, 1);
    background-size: 100% auto;
  }

  .monthExpenses_flex_0 {
    background: rgba(255, 255, 255, 1);
    width: 750rpx;
    height: 88rpx;
    overflow: hidden;
    z-index: 10;
    top: 0rpx;
    background-size: 100% auto;
  }

  .monthExpenses_fd0_0_c2_c0 {
    width: 119rpx;
    height: 55rpx;
    border-radius: 0rpx 0rpx 0rpx 0rpx;
  }

  .monthExpenses_fd0_0_c1_c0 {
    font-size: 36rpx;
    font-weight: 700;
    color: #333333;
    line-height: 50rpx;
  }

  .monthExpenses_fd0_0_c0_c0 {
    font-size: 36rpx;
    color: #333;
  }

  .monthExpenses_fd0_0_c0 {
    width: 120rpx;
  }

  .monthExpenses_fd0_0 {
    padding: 0rpx 32rpx 0rpx 32rpx;
  }

  .monthExpenses_flex_1 {
    background: rgba(255, 255, 255, 1);
    background-size: 100% auto;
  }

  .monthExpenses_fd1_0_c0 {
    color: #101010;
    font-size: 36rpx;
    font-weight: 700;
    line-height: 42rpx;
  }

  .monthExpenses_fd1_0 {
    padding: 24rpx 30rpx 24rpx 30rpx;
  }

  .monthExpenses_flex_2 {
    padding: 24rpx 30rpx 0rpx 30rpx;
  }

  .monthExpenses_fd2_0_c1_c2_c2 {
    margin: 0rpx 0rpx 0rpx 195rpx;
    color: #FF5050;
    font-size: 32rpx;
    font-weight: 400;
    line-height: 32rpx;
  }

  .monthExpenses_fd2_0_c1_c1_c2 {
    margin: 0rpx 0rpx 0rpx 206rpx;
    color: #FF5050;
    font-size: 32rpx;
    font-weight: 400;
    line-height: 32rpx;
  }

  .monthExpenses_fd2_0_c1_c1_c1 {
    margin: 0rpx 0rpx 0rpx 118rpx;
    color: #FF5050;
    font-size: 32rpx;
    font-weight: 400;
    line-height: 32rpx;
  }

  .monthExpenses_fd2_0_c1_c0_c1 {
    margin: 0rpx 0rpx 0rpx 63rpx;
  }

  .monthExpenses_fd2_0_c1_c0_c0 {
    margin: 0rpx 0rpx 0rpx 93rpx;
  }

  .monthExpenses_fd2_0_c0_c2 {
    padding: 32rpx 0rpx 32rpx 0rpx;
  }

  .monthExpenses_fd2_0_c0_c1_c2 {
    margin: 0rpx 0rpx 0rpx 214rpx;
    color: #FF5050;
    font-size: 32rpx;
    font-weight: 400;
    line-height: 32rpx;
  }

  .monthExpenses_fd2_0_c0_c1_c1 {
    margin: 0rpx 0rpx 0rpx 115rpx;
    color: #FF5050;
    font-size: 32rpx;
    font-weight: 400;
    line-height: 32rpx;
  }

  .monthExpenses_fd2_0_c0_c1_c0 {
    color: #101010;
    font-size: 32rpx;
    font-weight: 400;
    line-height: 32rpx;
  }

  .monthExpenses_fd2_0_c0_c1 {
    border-bottom: 1px solid #eee;
    padding: 32rpx 0rpx 32rpx 0rpx;
  }

  .monthExpenses_fd2_0_c0_c0_c1 {
    margin: 0rpx 0rpx 0rpx 97rpx;
  }

  .monthExpenses_fd2_0_c0_c0_c0_c1 {
    color: #666666;
    font-size: 26rpx;
    font-weight: 400;
    line-height: 32rpx;
  }

  .monthExpenses_fd2_0_c0_c0_c0_c0 {
    color: #101010;
    font-size: 34rpx;
    font-weight: 700;
    line-height: 42rpx;
  }

  .monthExpenses_fd2_0_c0_c0_c0 {
    margin: 0rpx 0rpx 0rpx 120rpx;
  }

  .monthExpenses_fd2_0 {
    background: url(image-path('44.png')) no-repeat;
    background-size: 100% auto;
    padding: 40rpx 46rpx 40rpx 38rpx;
  }

  .monthExpenses_flex_3 {
    padding: 40rpx 0rpx 48rpx 0rpx;
  }

  .monthExpenses_fd3_1_1 {
    background: rgba(37, 104, 174, 1);
    padding: 14rpx 51rpx 14rpx 51rpx;
    background-size: 100% auto;
    border-radius: 8rpx;
    color: rgba(255, 255, 255, 1);
    font-size: 28rpx;
    font-weight: 400;
    line-height: 46rpx;
    margin: 0rpx 0rpx 0rpx 60rpx;
  }

  .monthExpenses_fd3_1 {
    border: 1px solid rgba(16, 16, 16, 1);
    background: rgba(255, 255, 255, 1);
    padding: 14rpx 51rpx 14rpx 51rpx;
    background-size: 100% auto;
    border-radius: 8rpx;
    color: rgba(16, 16, 16, 1);
    font-size: 28rpx;
    font-weight: 400;
    line-height: 46rpx;
    margin: 0rpx 0rpx 0rpx 60rpx;
  }

  .monthExpenses_fd3_0_1 {
    border: 1px solid rgba(16, 16, 16, 1);
    background: rgba(255, 255, 255, 1);
    padding: 14rpx 51rpx 14rpx 51rpx;
    background-size: 100% auto;
    border-radius: 8rpx;
    color: rgba(16, 16, 16, 1);
    font-size: 28rpx;
    font-weight: 400;
    line-height: 46rpx;
    margin: 0rpx 60rpx 0rpx 0rpx;
  }

  .monthExpenses_fd3_0 {
    background: rgba(37, 104, 174, 1);
    padding: 14rpx 51rpx 14rpx 51rpx;
    background-size: 100% auto;
    border-radius: 8rpx;
    color: #FFFFFF;
    font-size: 28rpx;
    font-weight: 400;
    line-height: 46rpx;
    margin: 0rpx 60rpx 0rpx 0rpx;
  }

  .monthExpenses_flex_4 {
    padding: 0rpx 30rpx 0rpx 30rpx;
  }

  .monthExpenses_fd4_0_c1_c1 {
    margin: 32rpx 0rpx 0rpx 0rpx;
  }

  .monthExpenses_fd4_0_c1_c0_c1 {
    color: #101010;
    font-size: 30rpx;
    font-weight: 400;
    line-height: 32rpx;
    // width: 33.3%;
  }

  .monthExpenses_fd4_0_c1_c0_c0 {
    color: #666666;
    font-size: 28rpx;
    font-weight: 400;
    line-height: 32rpx;
  }

  .monthExpenses_fd4_0_c1 {
    background: rgba(248, 248, 250, 1);
    margin: 24rpx 0rpx 0rpx 0rpx;
    border-radius: 16rpx;
    background-size: 100% auto;
    padding: 32rpx 49rpx 32rpx 32rpx;
  }

  .monthExpenses_fd4_0_c0_c1 {
    color: #2568AE;
    font-size: 24rpx;
    font-weight: 400;
    line-height: 32rpx;
  }

  .monthExpenses_fd4_0_c0_c0 {
    color: #333333;
    font-size: 28rpx;
    font-weight: 400;
    line-height: 32rpx;
  }

  .monthExpenses_fd4_0 {
    background: rgba(255, 255, 255, 1);
    border-radius: 16rpx;
    background-size: 100% auto;
    margin: 0rpx 0rpx 24rpx 0rpx;
    padding: 24rpx;
  }
</style>
